/*
 * Copyright (c) 2011 Google Inc.
 * 
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
 * in compliance with the License. You may obtain a copy of the License at
 * 
 * http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software distributed under the License
 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
 * or implied. See the License for the specific language governing permissions and limitations under
 * the License.
 */

package com.snj.visangedu.calendar;


import java.io.IOException;

import android.os.AsyncTask;
import android.util.Log;

import com.snj.visangedu.studytime.StudyPlannerFragment;

/**
 * @author AA@google.com (Your Name Here)
 *
 */
public class GC_Delete_Event extends AsyncTask<Void, Void, Void> {
  private static final String TAG = "StudyPlan";

  private String deleteID;
  private boolean bReturn = true;

  GC_Delete_Event(String szID) {

    deleteID = szID;
  }

  @Override
  protected void onPreExecute() {
  }

  @Override
  protected Void doInBackground(Void... arg0) {
    try {
    	StudyPlannerFragment.Instance.client.events()
          .delete(StudyPlannerFragment.Instance.workCalendarInfo.id, deleteID).execute();

    } catch (IOException e) {
      Log.d(TAG, "IOException =" + e.getMessage());
      bReturn = false;
    } catch (Exception e) {
      Log.d(TAG, "> delete Exception =" + e.getMessage());
      Log.d(TAG, "> delete Event id =" + deleteID);
      bReturn = false;
    } finally {
    }
    return null;
  }

  @Override
  protected void onPostExecute(Void result) {
    AsyncManager.Instance.WorkProcessComplete("delete event", bReturn);
  }
}
